<?php
	$db = new Model_mdel;
	if(isset($_POST['type'])){
		date_default_timezone_set('Asia/Ho_Chi_Minh');
		$name	= $_POST['cart_name'];
		$cart_table	= $_POST['cart_table'];
		$message = $_POST['cart_message'];
		$total_price	= $_POST['cart_total'];
		$data = array(
			"ten"	=> $name,
			"ghichu"	=> $message,
			"soban"	=> $cart_table,
			"chuoi" => serialize($_SESSION['cart']),
			"giatien" => $total_price,
			"ngay"	=> time(),
			"ngay_timkiem" => date('m/d/Y')
		);
		//debug($data);
		//debug(serialize($_SESSION['cart']));
		$db->insert("donhang",$data);
		unset($_SESSION['cart']);
	}
?>